package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ServeclassServeGoodsRel;
import com.api.shopapi.entity.dto.ServeclassServeGoodsRelDTO;
import com.api.shopapi.mapper.ServeclassServeGoodsRelMapper;
import com.api.shopapi.service.ServeclassServeGoodsRelService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ServeclassServeGoodsRelServiceImplOne")
public class ServeclassServeGoodsRelServiceImpl implements ServeclassServeGoodsRelService {

    @Autowired
    private ServeclassServeGoodsRelMapper serveclassServeGoodsRelMapper;

    @Override
    public int insert(ServeclassServeGoodsRel serveclassServeGoodsRel) {
        return serveclassServeGoodsRelMapper.insert(serveclassServeGoodsRel);
    }

    @Override
    public List<ServeclassServeGoodsRel> getList() {
        return serveclassServeGoodsRelMapper.getList();
    }

    @Override
    public int update(ServeclassServeGoodsRel serveclassServeGoodsRel) {
        return serveclassServeGoodsRelMapper.update(serveclassServeGoodsRel);
    }

    @Override
    public List<ServeclassServeGoodsRel> getByGovernmentCode(String governmentCode) {
        return serveclassServeGoodsRelMapper.getByGovernmentCode(governmentCode);
    }

    @Override
    public ServeclassServeGoodsRel getByCodeAndGov(String governmentCode, String serveclassServeGoodsRelCode) {
        return serveclassServeGoodsRelMapper.getByCodeAndGov(governmentCode,serveclassServeGoodsRelCode);
    }

    @Override
    public ServeclassServeGoodsRel getByGoodsCode(String goodsCode) {
        return serveclassServeGoodsRelMapper.getByGoodsCode(goodsCode);
    }

    @Override
    public ServeclassServeGoodsRel getByGovAndServeCode(String governmentCode, String ServeclassCode, String ServeCode) {
        return serveclassServeGoodsRelMapper.getByGovAndServeCode(governmentCode,ServeclassCode,ServeCode);
    }

    @Override
    public PageInfo<ServeclassServeGoodsRelDTO> getPageList(int pageIndex, int pageSize, String serveclassName, String serveName, String governmentCode) {
        PageHelper.startPage(pageIndex,pageSize);
        List<ServeclassServeGoodsRelDTO> serveList =serveclassServeGoodsRelMapper.getPageList(serveclassName,serveName,governmentCode);
        return new PageInfo<>(serveList);
    }
}
